<%--
  Created by IntelliJ IDEA.
  User: 20275
  Date: 2023/11/15
  Time: 17:31
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head lang="en">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">


    <link href="${pageContext.request.contextPath}/vendor/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet">

    <title>登录</title>
</head>
<body>
<%
    Cookie[] cookies = request.getCookies();
    for(Cookie cookie:cookies){
        if(cookie.getName().equals("remember_cookie")){
            request.setAttribute("remember_", "true");
        }
        if(cookie.getName().equals("account_cookie")){
            request.setAttribute("account_", cookie.getValue());
        }
        if(cookie.getName().equals("pwd_cookie")){
            request.setAttribute("pwd_", cookie.getValue());
        }
    }
%>
<div class="container" style="margin-top: 70px">
    <div class="row">
        <div class="col-md-4 col-md-offset-4">
            <div class="login-panel panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">请登录</h3>
                    <% if(pageContext.findAttribute("message") != null || pageContext.findAttribute("Interceptor_Message") != null){ %>
                    <div class="alert alert-${alert_}"  role="alert" style="margin-top: 15px;">${message}${Interceptor_Message}</div>
                    <%
                            session.removeAttribute("message");
                            session.removeAttribute("Interceptor_Message");
                        } %>
                </div>
                <div class="panel-body">
                    <form role="form" method="post" action="${pageContext.request.contextPath}/login">
                        <fieldset>
                            <div class="form-group">
                                <input class="form-control" placeholder="账户" name="account" type="text"
                                       autofocus value="${account_}" required>
                            </div>
                            <div class="form-group">
                                <input class="form-control" placeholder="密码" name="password"
                                       type="password" value="${pwd_}" required>
                            </div>
                            <div class="checkbox">
                                <label>
                                    <% if(request.getAttribute("remember_") != null &&
                                            request.getAttribute("remember_").equals("true")){ %>
                                    <input name="remember" type="checkbox" checked="checked" value="true">记住密码
                                    <% } else{%>
                                    <input name="remember" type="checkbox" value="true">记住密码
                                    <% } %>
                                </label>
                                <label style="float: right"><a href="${pageContext.request.contextPath}/register.jsp">注册</a></label>
                            </div>
                            <input type="submit" value="登录" class="btn btn-lg btn-success btn-block"/>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- jQuery -->
<script src="${pageContext.request.contextPath}/vendor/jquery/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="${pageContext.request.contextPath}/vendor/bootstrap/js/bootstrap.min.js"></script>

<!-- Metis Menu Plugin JavaScript -->
<script src="${pageContext.request.contextPath}/vendor/metisMenu/metisMenu.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="${pageContext.request.contextPath}/dist/js/sb-admin-2.js"></script>

</body>
</html>
